import { Injectable } from '@nestjs/common';
import { Cron, CronExpression } from '@nestjs/schedule';
import { PostService } from 'src/post/post.service';

@Injectable()
export class TaskService {
  constructor(private readonly postService: PostService) {}
  @Cron(CronExpression.EVERY_DAY_AT_4AM)
  async handleCron() {
    await this.postService.saveToDb();
    await this.postService.supToRedis();
  }
}
